nr physical cpus is greater than max virtual cpus per domain.
Also do not initialise secondary CPU smp_processor_id() from
smpboot.c cpucount. It will be wrong if some CPUs fail to boot.
Signed-off-by: Keir Fraser <keir@xensource.com>
}
}
+void set_current_execstate(struct vcpu *v)
+{
+ percpu_ctxt[smp_processor_id()].curr_vcpu = v;
+}
+
struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
{
struct vcpu *v;
v->arch.flags = TF_kernel_mode;
- if ( is_idle_domain(d) )
- {
- percpu_ctxt[vcpu_id].curr_vcpu = v;
- v->arch.schedule_tail = continue_idle_domain;
- }
- else
- {
- v->arch.schedule_tail = continue_nonidle_domain;
- }
+ v->arch.schedule_tail = is_idle_domain(d) ?
+ continue_idle_domain : continue_nonidle_domain;
v->arch.ctxt_switch_from = paravirt_ctxt_switch_from;
v->arch.ctxt_switch_to = paravirt_ctxt_switch_to;
BUG_ON(idle_domain == NULL);
set_current(idle_domain->vcpu[0]);
+ set_current_execstate(idle_domain->vcpu[0]);
idle_vcpu[0] = current;
paging_init();
calibrate_tsc_ap();
}
-static int cpucount;
+static int cpucount, booting_cpu;
/* representing cpus for which sibling maps can be computed */
static cpumask_t cpu_sibling_setup_map;
* booting is too fragile that we want to limit the
* things done here to the most necessary things.
*/
- unsigned int cpu = cpucount;
+ unsigned int cpu = booting_cpu;
extern void percpu_traps_init(void);
- set_current(idle_vcpu[cpu]);
set_processor_id(cpu);
+ set_current(idle_vcpu[cpu]);
+ set_current_execstate(idle_vcpu[cpu]);
percpu_traps_init();
++cpucount;
+ booting_cpu = cpu;
+
if ((vcpu_id = cpu % MAX_VIRT_CPUS) == 0) {
d = domain_create(IDLE_DOMAIN_ID, cpu);
BUG_ON(d == NULL);
#define schedule_tail(_ed) (((_ed)->arch.schedule_tail)(_ed))
+extern void set_current_execstate(struct vcpu *v);
+
#endif /* __X86_CURRENT_H__ */